﻿using FirstFloor.ModernUI.Presentation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Export.Ui.ViewModel.Order
{
    public class OrderCommentViewModel
    {
        //private OrderDetail _newOrderDetail;
        private OrderDetailViewModel _orderDetailVM;
        private string _orderNo;

        public OrderCommentViewModel(OrderDetailViewModel orderDetailVM)
        {
            _orderDetailVM = orderDetailVM;
            InitailCommand();
            //_newOrderDetail = new OrderDetail();
            //_newOrderDetail.OrderNo = orderDetailVM._orderNo;
            _orderNo = orderDetailVM._orderNo;
        }

        public string OrderNo
        {
            get
            {
                return _orderNo;
            }

            set
            {
                _orderNo = value;
            }
        }

        public string Comment { get; set; }
        public bool IsReject { get; set; }

        public RelayCommand RejectCommand { get; set; }
        public RelayCommand CloseCommand { get; set; }

        private void InitailCommand()
        {
            RejectCommand = new RelayCommand(Reject);
            CloseCommand = new RelayCommand(close);
        }

        private void Reject(object parameter)
        {
            MessageBoxResult messageBoxResult = MessageBox.Show("Reject order number " + OrderNo, "Reject Confirmation", System.Windows.MessageBoxButton.YesNo);
            if (messageBoxResult == MessageBoxResult.Yes)
            {
                IsReject = true;
                _orderDetailVM.OrderCommentDialog.Close();
            }
        }

        private void close(object parameter)
        {
            _orderDetailVM.OrderCommentDialog.Close();
        }
    }
}
